package com.yn.xgame.gate;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * GateConfig
 * Created by wangboo on 17/7/12.
 */
public class GateConfig {

    private int id;
    private String innerIp;
    private int port;
    private String topic;
    private int maxUser;
    private String zkAddress;

    public GateConfig(String file) throws IOException {
        Properties prop = new Properties();
        InputStream is = getClass().getClassLoader().getResourceAsStream(file);
        prop.load(is);
        id = Integer.parseInt(prop.getProperty("id"));
        innerIp = prop.getProperty("innerIp");
        port = Integer.parseInt(prop.getProperty("port"));
        topic = "gate" + id;
        maxUser = Integer.parseInt(prop.getProperty("maxUser", "1000"));
        zkAddress = prop.getProperty("zkAddress");
    }

    public int getId() {
        return id;
    }

    public String getInnerIp() {
        return innerIp;
    }

    public int getPort() {
        return port;
    }

    public String getTopic() {
        return topic;
    }

    public int getMaxUser() {
        return maxUser;
    }

    public String getZkAddress() {
        return zkAddress;
    }
}
